(function($) {
	$(document).ready(function(e) {
		
		var oTable = $('#table-editable').dataTable();
		
		oTable.$('.editable-column').editable( 'modul/admin_nilai/item_update.php', {
			
			type   : 'text',
			"callback": function( sValue, y ) {
				
				if($(this).parent().attr('id')=='-'){
					var aPos = oTable.fnGetPosition( this );
					var arr = sValue.split(',');
					oTable.fnUpdate( arr[1]+" saved", aPos[0], aPos[1] );
					$(this).parent().attr('id',arr[0]);
				}else{
					oTable.fnUpdate( sValue, aPos[0], aPos[1] );
				}
			},
			"submitdata": function ( value, settings ) {
				return {
					"siswa" : $(this).parent().attr('data-siswa'),
					"materi" : $(this).parent().attr('data-materi'),
					"row_id": this.parentNode.getAttribute('id'),
					"column": oTable.fnGetPosition( this )[2]
				};
			},
			submit     : "ok",
			"height": "14px",
			"width": "100%"
		} );
		
		
	});
}) (jQuery);
